/**
 *
 */
package util;

import java.io.IOException;
import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.CoreConnectionPNames;

/**
 * @��Ŀ DangD
 * @���� User
 * @ʱ�� 2018��6��22�� ����10:09:23
 * @���� HttpClientUtil
 * @·��
 */
public class HttpClientUtil {
    public org.apache.http.HttpResponse HttoPost(Map<String, Object> params, String url) throws URISyntaxException, IOException {
        DefaultHttpClient client = new DefaultHttpClient();
        // ʵ����HTTP����
        HttpPost request = new HttpPost();
        request.setURI(new URI(url));
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        List<String> tagList = (List<String>) params.get("data_rfid");
        if (params != null) {
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
            }
        }
        request.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
        org.apache.http.HttpResponse response = client.execute(request);
        return response;
    }


}
